package startup

import (
	"gitee.com/kelvins-io/kelvins"
	"gitee.com/kelvins-io/kelvins-template-cron/service"
	"gitee.com/kelvins-io/kelvins-template-cron/vars"
)

func GenCronJobs() []*kelvins.CronJob {
	tasks := make([]*kelvins.CronJob, 0)
	if vars.EchoTimeTaskSetting != nil {
		if vars.EchoTimeTaskSetting.Cron != "" {
			tasks = append(tasks, &kelvins.CronJob{
				Name: "定时显示当前时间",
				Spec: vars.EchoTimeTaskSetting.Cron,
				Job:  service.EchoTime,
			})
		}
	}

	return tasks
}
